home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / SuperiorCanfield.dxr / playing cards_55_reserve cards.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  1.9 KB  |  73 lines

  1. property spriteNum, card, motion, location
  2. global reserve, stock, getlist, equal, currentsel, godlist, foundation, tableau, points
  3.  
  4. on beginSprite me
  5.   card = sprite(spriteNum)
  6.   card.member = member(stock.cards[1].rank & "_" & stock.cards[1].suit, "playing cards")
  7.   stock.cards.deleteAt(1)
  8.   reserve.addCard(spriteNum)
  9.   location = card.loc
  10. end
  11.  
  12. on mouseDown me
  13.   if card.member.name <> "empty" then
  14.     puppetSound(3, member("pick card", "100GPak Generic SFX"))
  15.     if spriteNum = reserve.getlastcard().spnum then
  16.       getlist = reserve
  17.       motion = timeout(string(spriteNum)).new(5, #movement, me)
  18.     else
  19.     end if
  20.   else
  21.     if card.member.name = "empty" then
  22.       sendSprite(spriteNum - 1, #mouseDown)
  23.     end if
  24.   end if
  25. end
  26.  
  27. on movement
  28.   if the mouseDown then
  29.     card.locZ = spriteNum + 1000
  30.     card.loc = the mouseLoc
  31.   else
  32.     if the mouseUp then
  33.       motion.forget()
  34.       card.locZ = spriteNum
  35.       card.loc = location
  36.     end if
  37.   end if
  38. end
  39.  
  40. on mouseUp me
  41.   if equal then
  42.     puppetSound(3, member("pick card", "100GPak Generic SFX"))
  43.     sprite(currentsel).member = member(sprite(spriteNum).member.name, "playing cards")
  44.     godlist.addCard(currentsel)
  45.     sprite(spriteNum).loc = location
  46.     reserve.cards.deleteOne(reserve.getlastcard())
  47.     sprite(spriteNum).member = member("empty", "playing cards")
  48.     equal = 0
  49.     if objectp(foundation[sprite(currentsel).row]) then
  50.       points = points + 10
  51.     end if
  52.     if objectp(tableau[sprite(currentsel).row]) then
  53.       repeat with i = 93 to 96
  54.         if tableau[sprite(i).row].getcardcount() = 0 then
  55.           next repeat
  56.         end if
  57.         sprite(i).loc = tableau[sprite(i).row].getlastcard().location
  58.       end repeat
  59.     end if
  60.     currentsel = 0
  61.     godlist = VOID
  62.     getlist = VOID
  63.     checkwin()
  64.   else
  65.     if not equal then
  66.       puppetSound(3, member("drop card", "100GPak Generic SFX"))
  67.       getlist = VOID
  68.       sprite(spriteNum).loc = location
  69.     end if
  70.   end if
  71.   checkwin()
  72. end
  73.